home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / cdity / ModeProSrc.lha / Prefs / PickBD.c < prev    next >
C/C++ Source or Header  |  1998-07-29  |  2KB  |  76 lines

  1. #include "mpp.h"
  2. extern UBYTE    ModePro[];
  3. extern STRPTR   MiscText[];
  4. extern UBYTE    filename[513];
  5. extern struct   FileRequester *BackdropFileReq;
  6. extern struct   TextAttr *TAttr;
  7.  
  8. #define PATH_SIZE 512
  9.  
  10. BOOL SelectBackdropFile(UBYTE *title,struct Window *Parent,STRPTR OldFile)
  11.   WORD width;
  12.   char path[PATH_SIZE],*file,*p2;
  13.   
  14.   
  15.   
  16.   if(OldFile)
  17.   {
  18.     file=FilePart(OldFile);
  19.     strncpy(path,OldFile,PATH_SIZE);
  20.     path[PATH_SIZE-1]=0;
  21.     if(p2=PathPart(path))
  22.     {
  23.       *p2=0;
  24.     }
  25.   }
  26.   else
  27.   {
  28.     file=0;
  29.     path[0]=0;
  30.   }
  31.   
  32.   if(!BackdropFileReq)
  33.   {
  34.     width=Parent->Width/2;
  35.     BackdropFileReq=(struct FileRequester *)AllocAslRequestTags(ASL_FileRequest, 
  36.                     ASLFR_TextAttr,        TAttr,
  37.                     ASLFR_InitialTopEdge,  Parent->TopEdge+8,
  38.                     ASLFR_InitialLeftEdge, Parent->LeftEdge+width/2,
  39.                     ASLFR_InitialWidth,    width,
  40.                     ASLFR_InitialHeight,   Parent->Height-16,
  41.  
  42.                     ASLFR_DoPatterns  ,    TRUE,
  43.                     ASLFR_InitialPattern,  "~(#?.info)",
  44.                     ASLFR_PrivateIDCMP,    TRUE,
  45.                     TAG_DONE); 
  46.   }
  47.   if(BackdropFileReq)
  48.   {
  49.     if(AslRequestTags(BackdropFileReq, 
  50.                   ASLFR_Window   ,       Parent,
  51.                   ASLFR_SleepWindow ,    TRUE,
  52.                   ASLFR_TitleText,       title,
  53.                   TAG_SKIP,              (file?0:2), // if no file skip the next 2
  54.                   ASLFR_InitialFile,     file,
  55.                   ASLFR_InitialDrawer,   path,
  56.                   TAG_DONE))
  57.     {
  58.       strncpy(filename,BackdropFileReq->fr_Drawer,512);
  59.       if(AddPart(filename,BackdropFileReq->fr_File,512))
  60.       {
  61.         BPTR l;
  62.         if(l=Lock(filename,ACCESS_READ))
  63.         {
  64.           NameFromLock(l,filename,512);
  65.           UnLock(l);
  66.         }
  67.         return(TRUE);
  68.       }
  69.     }   
  70.   }
  71.   return(FALSE);
  72. }
  73.  
  74.  
  75.